<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- 必须的 meta 标签 -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap 的 CSS 文件 -->
    <link rel="stylesheet" th:href="@{/static/bootstrap.min.css}">
    <title>OpenLearning</title>
</head>
<body>

<div class="container">
    <div th:replace="all_module::navbar"></div>

    <div th:replace="all_module::WorkReciteNavlist('nav-link','nav-link active','nav-link','nav-link')"></div>

    <div class="row">
        <div class="col-12 col-md-6">
            <div class="alert alert-success" role="alert" th:if="${info}" th:text="${info}"></div>
            <div class="alert alert-danger" role="alert" th:if="${error}" th:text="${error}"></div>
            <h4>单词环境设置</h4>
            <form th:action="@{/word/setting.do}" method="post">
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="basic-addon1">当前随机数种子</span>
                    </div>
                    <input name="seed" required  th:value="${session.setting.seed}" type="text" class="form-control" placeholder="种子" aria-label="Username" aria-describedby="basic-addon1">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="basic-addon2">当前背诵的单词数量</span>
                    </div>
                    <input name="reciteNum" required th:value="${session.setting.reciteNum}"  type="number" class="form-control" placeholder="每天背多少" aria-label="Username" aria-describedby="basic-addon2">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <label class="input-group-text" for="inputGroupSelect01" th:if="not ${session.setting.useWordBookUuid}">暂时无选择单词书</label>
                        <label class="input-group-text" for="inputGroupSelect01" th:if="${session.setting.useWordBookUuid}">修改当前单词书</label>
                    </div>
                    <select name="selectedBookUuid" required
                            th:if="${session.wordbooks}"
                            class="custom-select" id="inputGroupSelect01" >

                        <option th:selected="${session.setting.useWordBookUuid==wordbook.userWordBooks.getBookUuid()}" th:value="${wordbook.userWordBooks.bookUuid}" th:text="${wordbook.userWordBooks.wordBookNickname}" th:each="wordbook : ${session.wordbooks}"></option>
                    </select>
                </div>
                <button type="submit" class="btn btn-primary btn-block">保存设置</button>
            </form>
        </div>

        <div class="col-12 col-md-6">
            <h4>现有的单词表</h4>
            <table class="table">
                <thead class="thead-dark">
                <tr>
                    <th scope="col">单词表</th>
                    <th scope="col">已经背过/总单词数量</th>
                </tr>
                </thead>
                <tbody>
                    <tr th:each="wordbook : ${session.wordbooks}">
                        <th th:text="${wordbook.userWordBooks.wordBookNickname}">单词表1</th>
                        <th><span th:text="${wordbook.userRecitedWordCount}"></span> / <span th:text="${wordbook.wordCount}"></span></th>
                    </tr>
                </tbody>
            </table>
        </div>


        <br><br>
        <div class="col-12 col-md-6">
            <button class="btn btn-danger btn-block" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
                清空单词的背诵记录
            </button>
            <div class="collapse" id="collapseExample">
                <form th:action="@{/word/clearUserRecitedWord.do}" method="post">
                    <div class="card card-body">

                        <div class="alert alert-danger" role="alert">
                            请慎重删除！删除后没有任何后悔的余地！
                        </div>

                        <div class="form-check">
                            <input class="form-check-input" type="radio" name="allClear" id="exampleRadios1" value="true" checked>
                            <label class="form-check-label" for="exampleRadios1">
                                全部清除
                            </label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" checked type="radio" name="allClear" id="exampleRadios2" value="false">
                            <label class="form-check-label" for="exampleRadios2">
                                只清除当前单词书
                            </label>
                        </div>
                        <br>
                        <button type="submit" class="btn btn-outline-danger">点击清空</button>
                    </div>
                </form>
            </div>
        </div>
        <br>

    </div>
</div>


<!-- 选项 1：jQuery 和 Bootstrap 集成包（集成了 Popper） -->
<script th:src="@{/static/jquery.slim.min.js}"> </script>
<script th:src="@{/static/bootstrap.bundle.min.js}"></script>
<script th:src="@{/static/vue2.js}"></script>
<script>


</script>


</body>
</html>